

 var str="";
 
   str= getvl("chanshu");
   var strs=str.split(",");
   
 var userid=getvl("id");
 $(function(){
 	weihuofabu(str);
 });
 
 
function weihuofabu(str){
    	$("#fabuweihuo").html("");
    	 $.ajax({
      url: urlcore + "/api/goods/selectgoodsAllag?str="+str,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					var sun=1;
					//alert(JSON.stringify(data.data));
					$.each(data.data, function(y,n) {
				var fabuweihuo='<div class="clearfix add_goods">'+
'		<div class="public-xuanze fl" >'+
'			<img src="../images/delete.png" onclick="removeByValues('+n.id+')" width="20" height="20" />'+
'		</div>'+
'		<div class="clearfix tuwen">'+
'	    	<a href="javascript:void(0);">'+
'		        <div class="tuwen-img fl">'+
'		            <img onerror="errorImg(this)" src="'+n.coverUrl+'" width="75" height="75">'+
'		        </div>'+
'		        <div class="tuwen-wenzi">'+
'		            <h5 class="wuye_h01">'+n.goodsTitle+'</h5>'+
'		            <div class="wuye_div02">&yen;'+n.tradePrice+'-&yen;'+n.getPrice+'</div>'+
'		        </div>'+
'	        </a>'+
'	    </div>'+
'	</div>';
                 $("#fabuweihuo").append(fabuweihuo);
					});
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}
			},
			error: function() {
				alert("error");
			}
		});	
}

 //提交
   function tijiaos(){
   	if(userid!=''){
   			var sts=strs.toString();
   			//alert(sts);
   			var kuchun=$("#kuchun").val();
   			var shihuijia=$("#shihuijia").val();
		 $.ajax({
		url: urlcore + "/api/rushGoods/addRush2",
		type: "post",
		contentType: "application/json;charset=utf-8",
		data: JSON.stringify({
	       sellerId:userid,
           rushgoodsid:sts,
        rushAmount:kuchun,
        cheapPrice:shihuijia
        
		}),
		dataType: "json",
		success: function(data) {
			if(data.success == true) {
				alert("添加成功！");
		window.location.href ="22.2.1huodong_xianshi_shenqing.html";
		     }
		},error: function() {
			alert("error");
		}
	});
   	}else{
   		
   		alert("异常");
   	}
   	
   }
   
   
   



//删除数组元素
function removeByValues(val) {
	alert(val);
  removeByValue(strs,val);
    strs.toString();
 alert(strs.toString())
  weihuofabu(strs);
}














 goumai();
 function goumai(){
 	     
		  $("#chuchuang").html("");
		$.ajax({
             url:urlcore + "/api/incrementService/selectWindowList",
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					$.each(data.data.list, function(y,m) {
						var chuchuang='<li class="clearfix">'+
'			<dl>'+
'				<dt>'+
'					<img src="../images/zengzhi07.png">'+
'				</dt>'+
'				<dd>'+
'					<h2>'+m.title+'</h2>'+
'					<h6>有效期：'+m.validityTime+'天</h6>'+
'				</dd>'+
'			</dl>'+
'			<a href="#">&yen;'+m.price+'</a>'+
'		</li>';
						    $("#chuchuang").append(chuchuang);
					});
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					//alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "../1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}

			},
			error: function() {
				alert("error");
			}
		});

 }
